﻿using System;



class SelectionSort
{
    static void Main()
    {
        Console.Write("How long will be your array : ");
        int n = int.Parse(Console.ReadLine());
        int[] Array = new int[n];
        Console.WriteLine("Insert {0} integer", n);
        for (int i = 0; i < Array.Length; i++)
        {
            Console.Write("{0}:", i + 1);
            Array[i] = int.Parse(Console.ReadLine());
        }
        int MinimulValueIndex = 0;
        for (int i = 0; i < Array.Length-1; i++)
        {
            MinimulValueIndex = i; 
            for (int j = i+1; j < Array.Length; j++)
            {
                if (Array[MinimulValueIndex]>Array[j])
                {
                MinimulValueIndex = j;
                }
            }
            if (Array[i] != Array[MinimulValueIndex])
            {
                int KeepingValue = Array[MinimulValueIndex];
                Array[MinimulValueIndex] = Array[i];
                Array[i] = KeepingValue;
            }
        }
        Console.WriteLine("Sorted Array :");
        for (int r = 0; r < Array.Length; r++)
        {
            Console.Write("{0} " , Array[r]);   
        }
        Console.WriteLine();
    }
}